package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	
	/**
	 * ...
	 * @author Arthas
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		

		
	
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
		
			addEventListener(MouseEvent.CLICK, onClick);
			// entry point
			
			
			
			_chart = new Chart(400, 400);
			_chart.x = 20;
			_chart.y = 20;
			this.addChild(_chart);
		}

		private var _chart:Chart;
		private var start_x:int = 10;
		private var start_y:int = 10;
		
		
		private function onClick(e:MouseEvent):void {
			start_x += Math.random() * 30;
			start_y += Math.random() * 30;
			
			_chart.add(new Point(start_x, start_y));
		}
	}
	
}